﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace YJKRevitArea.AreaSet
{
	internal class MergeFireZone
	{
		public MergeFireZone(ExternalCommandData commandData, Dictionary<FireZoneInfo, List<Area>> NamedSortArea)
		{
			this.m_comData = commandData;
			this.m_doc = commandData.Application.ActiveUIDocument.Document;
			this.m_NamedSortArea = NamedSortArea;
		}

		public bool SolveGroupedArea()
		{
			foreach (KeyValuePair<FireZoneInfo, List<Area>> itemGroupArea in this.m_NamedSortArea)
			{
				if (!new AreaCreator(this.m_comData).MergeFireZoneByBoundCurve(this.m_doc, itemGroupArea))
				{
					return false;
				}
			}
			return true;
		}

		private ExternalCommandData m_comData;

		private Document m_doc;

		private Dictionary<FireZoneInfo, List<Area>> m_NamedSortArea;
	}
}
